<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/page/common/commonConfig.jsp"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 
<html>
	<head>
		<base href="<%=basePath%>">
		<title>更新用户详细</title>
		<script src="<%=basePath%>component/layout.js"></script>
    	<script src="<%=basePath%>component/toolbar.js"></script>
		<script type="text/javascript" src="<%=basePath%>js/validateJS.js"></script>
		<script type="text/javascript" src="<%=basePath%>js/tableForm.js"></script>
		<script type="text/javascript">
			var dhxLayout = createLayoutNormal('1C',false,true);	
		
			function validateDel(){
				confirmInfo('确认删除用户详细信息',
					function(choose){
						if('ok' == choose){
							layoutProgressOn(dhxLayout);
							document.forms["clearForm"].submit();
						}else{
							return;
						}
					}
				);
			}
			
			function validateEdit(){
				
				var userCoding = document.getElementById('tuserinfo.userCoding').value;
				if (userCoding != '' && !validatePattern.validateInputZZ(userCoding,false)){
					myAlert('编号非法，输入只能是[汉字,数字、26个英文字母或者下划线]');
					return ;
				}
			
				var userName = document.getElementById('tuserinfo.userName').value;
				if (userName != '' && !validatePattern.validateChinese(userName,false)){
					myAlert('姓名非法，输入只能是[汉字]');
					return ;
				}
			
				var userTel = document.getElementById('tuserinfo.userTel').value;
				if (userTel != '' && !validatePattern.validateMobile_yd(userTel,false)){
					myAlert('请您输入正确的移动手机号码');
					return ;
				}
			
				var userUnitPhone = document.getElementById('tuserinfo.userUnitPhone').value;
				if (userUnitPhone != '' && !validatePattern.validatePhone(userUnitPhone,false)){
					myAlert('办公电话非法');
					return ;
				}
			
				var userOwnPhone = document.getElementById('tuserinfo.userOwnPhone').value;
				if (userOwnPhone != '' && !validatePattern.validatePhone(userOwnPhone,false)){
					myAlert('家庭电话非法');
					return ;
				}
			
				var userEmail = document.getElementById('tuserinfo.userEmail').value;
				if (userEmail != '' && !validatePattern.validateEmail(userEmail,false)){
					myAlert('邮箱地址格式不正确');
					return ;
				}
			
				var userEmailOther = document.getElementById('tuserinfo.userEmailOther').value;
				if (userEmailOther != '' && !validatePattern.validateEmail(userEmailOther,false)){
					myAlert('其他邮箱地址格式不正确');
					return ;
				}
			
				var identytyNumber = document.getElementById('tuserinfo.identytyNumber').value;
				if (identytyNumber != '' && !validatePattern.validateNumber(identytyNumber,false)){
					myAlert('证件号码非法，输入只能是[数字]');
					return ;
				}
				
				layoutProgressOn(dhxLayout);
				document.forms["editForm"].submit();
			}
			
			function configLayout(){
				var a = dhxLayout.cells('a');
				a.hideHeader();
				a.setText('主页面');
				a.fixSize(true, true);
				createToolbarFromDHXLayoutCell(a,function(toolbar){
				    toolbar.addText("info", 1, "操作:");
				    toolbar.addSeparator("sep1", 2);
			    	toolbar.addButton("update", 4, "修改", "settings.gif", "settings.gif");
			    	toolbar.addButton("submit", 5, "提交", "save.gif", "save_dis.gif");
			    	toolbar.addButton("cancel", 6, "取消", "undo.gif", "undo_dis.gif");
			    	toolbar.hideItem('submit');
			    	toolbar.hideItem('cancel');
				    toolbar.addButton("delete", 7, "删除", "cut.gif", "cut_dis.gif");
				    toolbar.attachEvent("onClick", function(id) {
				    	if(id == 'delete'){
				    		validateDel();
				    	}
				    	if(id == 'update'){
				    		tableForm.tableToForm();
				    		toolbar.showItem('submit');
				    		toolbar.showItem('cancel');
				    		toolbar.hideItem('update');
				    	}
				    	if(id == 'cancel'){
				    		tableForm.formReturnTable();
				    		toolbar.showItem('update');
				    		toolbar.hideItem('cancel');
				    		toolbar.hideItem('submit');
				    	}
				    	if(id == 'submit'){
				    		validateEdit();
				    	}
				    });
				});
				a.attachObject('dataObj');
			}
			
			$(function(){
				configLayout();
			});
		</script>
	</head>

	<body>
		<div id="dataObj">
		<div id="displayDiv" class="formlayout" style="overflow: auto;width:100%;height:100%;">
			<c:if test="${!empty userInfoEdit}">
			<form action="<%=basePath%>system-personalInfo/PersonalInfoAction!userInfoEditPersonalUserInformation.action" method="post" name="editForm">
			<input type="hidden" name="tuserinfo.id" id="tuserinfo.id" value="${userInfoEdit.id }"/>
			<input type="hidden" name="tuserinfo.userMainId" id="tuserinfo.userMainId" value="${userInfoEdit.userMainId }"/>
			<table>
				<tr>	
					<th>编号</th>
					<td>
						${userInfoEdit.userCoding }
						<input type="hidden" name="editFormHidden"
						 value="[{type:'input',id:'tuserinfo.userCoding',name:'tuserinfo.userCoding',value:'${userInfoEdit.userCoding }',showText:'${userInfoEdit.userCoding }',maxlength:'25'}]"/>
					</td>
				</tr>
				<tr>	
					<th>姓名</th>
					<td>
						${userInfoEdit.userName }
						<input type="hidden" name="editFormHidden"
						 value="[{type:'input',id:'tuserinfo.userName',name:'tuserinfo.userName',value:'${userInfoEdit.userName }',showText:'${userInfoEdit.userName }',maxlength:'25'}]"/>
					</td>
				</tr>
				<tr>	
					<th>性别</th>
					<td>
						<c:if test="${userInfoEdit.userSex eq 'M'}">男</c:if><c:if test="${userInfoEdit.userSex eq 'F'}">女</c:if>
						<input type="hidden" name="editFormHidden" value="[{type:'select',id:'tuserinfo.userSex',name:'tuserinfo.userSex',value:'M&男|F&女',defaultSelect:'${tuserinfo.userSex }',
							showText:'<c:if test="${userInfoEdit.userSex eq 'M'}">男</c:if><c:if test="${userInfoEdit.userSex eq 'F'}">女</c:if>'}]"/>					
					</td>
				</tr>
				<tr>	
					<th>手机号码</th>
					<td>
						${userInfoEdit.userTel }
						<input type="hidden" name="editFormHidden"
						 value="[{type:'input',id:'tuserinfo.userTel',name:'tuserinfo.userTel',value:'${userInfoEdit.userTel }',showText:'${userInfoEdit.userTel }',maxlength:'25'}]"/>
					</td>
				</tr>
				<tr>	
					<th>办公电话</th>
					<td>
						${userInfoEdit.userUnitPhone }
						<input type="hidden" name="editFormHidden"
						 value="[{type:'input',id:'tuserinfo.userUnitPhone',name:'tuserinfo.userUnitPhone',value:'${userInfoEdit.userUnitPhone }',showText:'${userInfoEdit.userUnitPhone }',maxlength:'25'}]"/>
					</td>
				</tr>
				<tr>	
					<th>家庭电话</th>
					<td>
						${userInfoEdit.userOwnPhone }
						<input type="hidden" name="editFormHidden"
						 value="[{type:'input',id:'tuserinfo.userOwnPhone',name:'tuserinfo.userOwnPhone',value:'${userInfoEdit.userOwnPhone }',showText:'${userInfoEdit.userOwnPhone }',maxlength:'25'}]"/>
					</td>
				</tr>
				<tr>
					<th>邮箱</th>
					<td>
						${userInfoEdit.userEmail }
						<input type="hidden" name="editFormHidden"
						 value="[{type:'input',id:'tuserinfo.userEmail',name:'tuserinfo.userEmail',value:'${userInfoEdit.userEmail }',showText:'${userInfoEdit.userEmail }',maxlength:'25'}]"/>
					</td>
				</tr>
				<tr>
					<th>其他邮箱</th>
					<td>
						${userInfoEdit.userEmailOther }
						<input type="hidden" name="editFormHidden"
						 value="[{type:'input',id:'tuserinfo.userEmailOther',name:'tuserinfo.userEmailOther',value:'${userInfoEdit.userEmailOther }',showText:'${userInfoEdit.userEmailOther }',maxlength:'25'}]"/>
					</td>
				</tr>
				<tr>
					<th>联系地址</th>
					<td>
						${userInfoEdit.userAddress }
						<input type="hidden" name="editFormHidden"
						 value="[{type:'input',id:'tuserinfo.userAddress',name:'tuserinfo.userAddress',value:'${userInfoEdit.userAddress }',showText:'${userInfoEdit.userAddress }',maxlength:'25'}]"/>
					</td>
				</tr>
				<tr>	
					<th>证件类型</th>
					<td>
						<c:if test="${userInfoEdit.identytyType eq 1}">身份证</c:if>
						<c:if test="${userInfoEdit.identytyType eq 2}">军官证</c:if>
						<c:if test="${userInfoEdit.identytyType eq 3}">其他</c:if>
						<input type="hidden" name="editFormHidden"
							value="[{type:'select',id:'tuserinfo.identytyType',name:'tuserinfo.identytyType',value:'1&身份证|2&军官证|3&其他',defaultSelect:'${userInfoEdit.identytyType }',
								showText:'<c:if test="${userInfoEdit.identytyType eq 1}">身份证</c:if><c:if test="${userInfoEdit.identytyType eq 2}">军官证</c:if><c:if test="${userInfoEdit.identytyType eq 3}">其他</c:if>'}]"/>							
					</td>
				</tr>
				<tr>	
					<th>证件号码</th>
					<td>
						${userInfoEdit.identytyNumber }
						<input type="hidden" name="editFormHidden"
						 value="[{type:'input',id:'tuserinfo.identytyNumber',name:'tuserinfo.identytyNumber',value:'${userInfoEdit.identytyNumber }',showText:'${userInfoEdit.identytyNumber }'}]"/>
					</td>
				</tr>
			</table>
		</form>
			</c:if>
		</div>
		
		<div id="delDiv" style="display:none"><!-- 删除信息 -->
			<form action="<%=basePath%>system-personalInfo/PersonalInfoAction!userInfoEditClearPerson.action" method="post" name="clearForm">
				<input type="hidden" name="tuserinfo.id" id="tuserinfo.id" value="${userInfoEdit.id }"/>
				<input type="hidden" name="tuserinfo.userMainId" id="tuserinfo.userMainId" value="${userInfoEdit.userMainId }"/>
			</form>
		</div></div>
	</body>
</html>
